<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;

/* @var $this yii\web\View */
/* @var $model app\modules\admin\models\CwTpl1Article */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="cw-tpl1-article-form">

    <?php $form = ActiveForm::begin(); ?>

    <?= $form->field($model, 'ta1_title')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'ta1_pic_url')->fileInput(['class' => 'btn btn-default']) ?>

    <?= $form->field($model, 'ta1_content')->widget(yii\redactor\widgets\Redactor::className(),[
            'clientOptions' => [
                'imageManagerJson' => ['/redactor/upload/image-json'],
                'imageUpload' => ['/redactor/upload/image'],
                'fileUpload' => ['/redactor/upload/file'],
                'lang' => 'zh_cn',
                'plugins' => ['clips', 'fontcolor','imagemanager'],
            ]
        ])?>

    <?= $form->field($model, 'ta1_json')->textarea(['rows' => 6, 'id' => 'json']) ?>

    <?= $form->field($model, 'ta1_time')->textInput(['readonly' => true, 'maxlength' => true, 'value' => date("Y-m-d H:i:s")]) ?>

    <div class="form-group">
        <?= Html::submitButton($model->isNewRecord ? '发布' : '修改', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
    </div>

    <?php ActiveForm::end(); ?>

</div>
<script>
    document.getElementById('cw-tpl').setAttribute('class',"active");
    if (document.getElementById('json').value == ''){
        document.getElementById('json').value = '{\n\t"标题":"超链接",\n\t"标题":"超链接"\n}';
    };
</script>
